<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Promise.allSettled</title>
</head>

<body>
    <script>
      //声明两个 promis 对象
        const p1 = new Promise((resolve,reject) =>{
          setTimeout(() => {
            resolve('商品数据----1');
            // reject("错误哦哦哦哦哦")
          }, 1000);
        });

        const p2 = new Promise((resolve,reject) =>{
          setTimeout(() => {
            resolve('商品数据----2')
            // reject("出错啦啦啦啦啦啦")
          }, 1000);
        })

      //调用  allSettled  方法
      // const result = Promise.allSettled([p1,p2]);

      //调用  all  方法
       const res = Promise.all([p1,p2]);
      
      console.log(res);

    </script>
</body>
</html>